﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Windsor;
using Castle.Windsor.Configuration.Interpreters;
using Castle.MicroKernel.Registration;
using System.Collections;

namespace CH.Easy.CMS.Infrastructure.Ioc
{
    public class IocContainer
    {
        static IWindsorContainer container;
        static IocContainer() 
        {
            container = new WindsorContainer(new XmlInterpreter());
        }

        public static IWindsorContainer Register(params IRegistration[] registrations)
        {
            return container.Register(registrations);
        }


        public static object Resolve(string key, IDictionary arguments)
        {
            return container.Resolve(key, arguments);
        }

        public static object Resolve(string key, Type service, object argumentsAsAnonymousType)
        {
            return container.Resolve(key,service, argumentsAsAnonymousType);
        }

        public static object Resolve(string key, Type service, IDictionary arguments)
        {
            return container.Resolve(key, service, arguments);
        }

        public static T Resolve<T>(string key, object argumentsAsAnonymousType)
        {
            return container.Resolve<T>(key, argumentsAsAnonymousType);
        }

        public static T Resolve<T>(string key, IDictionary arguments)
        {
            return container.Resolve<T>(key, arguments);
        }

        public static T Resolve<T>(string key)
        {
            return container.Resolve<T>(key);
        }

        public static T Resolve<T>(object argumentsAsAnonymousType)
        {
            return container.Resolve<T>(argumentsAsAnonymousType);
        }

        public static T Resolve<T>(IDictionary arguments)
        {
            return container.Resolve<T>(arguments);
        }

        public static T Resolve<T>()
        {
            return container.Resolve<T>();
        }

        public static object Resolve(Type service, object argumentsAsAnonymousType)
        {
            return container.Resolve(service, argumentsAsAnonymousType);

        }

        public static object Resolve(Type service, IDictionary arguments)
        {
            return container.Resolve(service, arguments);
        }

        public static object Resolve(Type service)
        {
            return container.Resolve(service);
        }

        public static object Resolve(string key, Type service)
        {
            return container.Resolve(service, service);
        }

        public static T[] ResolveAll<T>(object argumentsAsAnonymousType)
        {
            return container.ResolveAll<T>(argumentsAsAnonymousType);
        }

        public static T[] ResolveAll<T>(IDictionary arguments)
        {
            return container.ResolveAll<T>(arguments);
        }

        public static Array ResolveAll(Type service, object argumentsAsAnonymousType)
        {
            return container.ResolveAll(service, argumentsAsAnonymousType);
        }

        public static Array ResolveAll(Type service, IDictionary arguments)
        {
            return container.ResolveAll(service, arguments);
        }

        public static Array ResolveAll(Type service)
        {
            return container.ResolveAll(service);
        }

        public static T[] ResolveAll<T>()
        {
            return container.ResolveAll<T>();
        }


    }
}
